<?php
// 本类由系统自动生成，仅供测试用途
class MemberAction extends BaseLoginAction {
   function __construct() {
       parent::__construct();
       
   }
    public function index(){
        
    }
    
    public function pass(){ //重设密码
        $this->display();
        
    }
    public function dopass(){   //重设密码执行页
        if(isset($_POST['password'])&& $_POST['password']!=''
                &&isset($_POST['password_new'])&& $_POST['password_new']!=''
                &&isset($_POST['password_new1'])&& $_POST['password_new1']!=''
                &&$_POST['password_new']==$_POST['password_new1']){
            $where=Array(
                "mid"=>  $this->uid
            );
            $member=D("member");
            $rs=$member->where($where)->find();
            if(md5($_POST['password'])==$rs['member_password']){
                $password=md5($_POST['password_new']);
                $data=Array(
                    "member_password"=>$password
                );
                $update=$member->where($where)->data($data)->save();
                if($update){
                    $this->success("修改成功");
                }else{
                    $this->error("修改失败");
                }
            }else{
                $this->error("原始密码错误");
            }
            
            
        }else{
            $this->error("数据错误");
        }
        
    }
}